package com.smartleanx.module.hrm.dal.mysql.examine.examineRecord;

import java.util.*;

import com.smartleanx.framework.common.pojo.PageResult;
import com.smartleanx.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.smartleanx.framework.mybatis.core.mapper.BaseMapperX;
import com.smartleanx.module.hrm.dal.dataobject.examine.examineRecord.ExamineRecordDO;
import org.apache.ibatis.annotations.Mapper;
import com.smartleanx.module.hrm.controller.admin.examine.examineRecord.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 考核计划开始后生成记录 Mapper
 *
 * @author 
 */
@Mapper
public interface ExamineRecordMapper extends BaseMapperX<ExamineRecordDO> {

    default PageResult<ExamineRecordDO> selectPage(ExamineRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ExamineRecordDO>()
                .eqIfPresent(ExamineRecordDO::getEmployeeId, reqVO.getEmployeeId())
                .eqIfPresent(ExamineRecordDO::getEmployeeNo, reqVO.getEmployeeNo())
                .eqIfPresent(ExamineRecordDO::getDepartmentId, reqVO.getDepartmentId())
                .eqIfPresent(ExamineRecordDO::getPostId, reqVO.getPostId())
                .eqIfPresent(ExamineRecordDO::getExanineType, reqVO.getExanineType())
                .eqIfPresent(ExamineRecordDO::getExamineStatus, reqVO.getExamineStatus())
                .eqIfPresent(ExamineRecordDO::getExamineGradeId, reqVO.getExamineGradeId())
                .eqIfPresent(ExamineRecordDO::getRatingScore, reqVO.getRatingScore())
                .eqIfPresent(ExamineRecordDO::getExamineYear, reqVO.getExamineYear())
                .eqIfPresent(ExamineRecordDO::getCycleTimeType, reqVO.getCycleTimeType())
                .eqIfPresent(ExamineRecordDO::getCycleType, reqVO.getCycleType())
                .eqIfPresent(ExamineRecordDO::getExamineIllustrate, reqVO.getExamineIllustrate())
                .eqIfPresent(ExamineRecordDO::getIsLowPerformance, reqVO.getIsLowPerformance())
                .eqIfPresent(ExamineRecordDO::getExamineId, reqVO.getExamineId())
                .orderByDesc(ExamineRecordDO::getId));
    }

    List<ExamineRecordDO> selectByRateStatus(@Param("pageNum")Integer pageNum,
                                             @Param("pageSize")Integer pageSize ,
                                             @Param("employeeName") String employeeName,
                                             @Param("employeeNo")String employeeNo,
                                             @Param("deptId")Integer deptId,
                                             @Param("postId")Integer postId,
                                             @Param("employeeState")Integer employeeState,
                                             @Param("sourceUnit")Integer sourceUnit,
                                             @Param("sources")Integer sources);
    Long selectByRateStatusCount(@Param("pageNum")Integer pageNum,
                                 @Param("pageSize")Integer pageSize ,
                                 @Param("employeeName") String employeeName,
                                 @Param("employeeNo")String employeeNo,
                                 @Param("deptId")Integer deptId,
                                 @Param("postId")Integer postId,
                                 @Param("employeeState")Integer employeeState,
                                 @Param("sourceUnit")Integer sourceUnit,
                                 @Param("sources")Integer sources);

}